<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<html>
<head>
<meta charset="UTF-8">
<title>首页</title>
</head>
<body>
<h2>验证码生成!</h2>

<div style="margin:auto;width:50%;">
<form method="post" action="<%=request.getContextPath()%>/login">
验证码：<input type="text" name="code" />
<img alt="验证码" id="img" src="<%=request.getContextPath()%>/image"/><a href="javascript:reload();">看不清楚</a><br>
<input type="submit"></input>
<input type="reset"></input>
</form>
</div>

<br><br><br>
<div style="margin:auto;width:50%;">
二维码：<input type="text" name="qrcode" id="qr"/><a href="javascript:upload();">提交</a><br>
<img alt="二维码" id="qrimg" src="<%=request.getContextPath()%>/parse"/><br>

</form>
</div>

<script>
	function reload() {
		//window.reload();
		//alert(1);
		var time = new Date().getTime();
		document.getElementById('img').src = "<%=request.getContextPath()%>/image?d="+time;
	}
	
	function upload() {
		//window.reload();
		//alert(1);
		var time = new Date().getTime();
		var qr = document.getElementById('qr');
		//alert(qr);
		document.getElementById('qrimg').src = "<%=request.getContextPath()%>/parse?qrcode="+qr.value+"&d="+time;
		qr.value = '';
	}
</script>
</body>
</html>
